import React from 'react'
//功能：把ThemeContext上下文这个换肤功能变成高阶组件，功能复用
import ThemeContext from './theme'
const {Consumer}=ThemeContext
export default function admin(WrappedComponent){
    return props=>{
        return(
            <Consumer>
                {
                    theme=>(
                        <div
                            style={{
                                    color: theme.color,
                                    background: theme.background
                                  }}>
                            <WrappedComponent {...props} />
                        </div>
                    )
                }
            </Consumer>
        )
    }
}